package com.sali.b_design_pattern.l_prototype_pattern.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @description:
 * @author: zhang hang
 * @date: 2023/3/18 21:31.
 * @version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class PrototypeVersion2 implements Cloneable {

    private String name;

    /**
     * description: 它也要实现cloneable接口！
     **/
    private Addresss2 addresss2;

    @Override
    public Object clone() throws CloneNotSupportedException {
        PrototypeVersion2 prototypeVersion2 = (PrototypeVersion2) super.clone();
        prototypeVersion2.addresss2 = (Addresss2) addresss2.clone();
        return prototypeVersion2;
    }
}
